package com.hpsk.common;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.Setter;

/**
 * @author huangwang2832511019
 */
@Getter
@Setter
public class CommonException extends RuntimeException{

    private int code;
    private String msg;

    public CommonException() {
        super("服务器异常");
        this.code = RespCodeEnum.SERVER_ERROR.getCode();
        this.msg = RespCodeEnum.SERVER_ERROR.getMsg();
    }

    public CommonException(String msg, Object... arguments) {
        super(StrUtil.format(msg, arguments));
        this.code = 500;
        this.msg = StrUtil.format(msg, arguments);
    }

    public CommonException(Integer code, String msg, Object... arguments) {
        super(StrUtil.format(msg, arguments));
        this.code = code;
        this.msg = StrUtil.format(msg, arguments);
    }
}
